<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/NoFrameTemplate.xhtml">
        <ui:define name="content">          
            <h:form>
                <h:panelGroup id="displayInvoiceAndPayment">
                    <p:panel header="Receipt # #{customerInvoiceEntityController.selected.receipt.id}" >
                        <p:fieldset legend="Cash-in-Advance Invoice # #{customerInvoiceEntityController.selected.id}"
                                    rendered="#{customerInvoiceEntityController.selected.CIA}">  
                            <ui:include src="/entities/customerInvoiceEntity/ViewCIAInvoice.xhtml" />
                        </p:fieldset>

                        <p:fieldset legend="Normal Invoice # #{customerInvoiceEntityController.selected.id}" 
                                    rendered="#{customerInvoiceEntityController.selected.normal}">
                            <ui:include src="/entities/customerInvoiceEntity/ViewNormalInvoice.xhtml" />
                        </p:fieldset>

                        <p:fieldset legend="Reminder Invoice # #{customerInvoiceEntityController.selected.id}" 
                                    rendered="#{customerInvoiceEntityController.selected.reminder}">
                            <ui:include src="/entities/customerInvoiceEntity/ViewReminderInvoice.xhtml" />
                        </p:fieldset>
                        <br />

                        <p:fieldset legend="Payment # #{customerInvoiceEntityController.selected.payment.id}" rendered="#{customerInvoiceEntityController.selected.paid}">  
                            <h:panelGrid columns="2" cellpadding="10">  
                                <h:outputText value="Payment date: " />
                                <h:outputText value="#{customerInvoiceEntityController.selected.payment.createdAt}" />

                                <h:outputText value="On time: " />
                                <h:outputText value="#{!customerInvoiceEntityController.selected.payment.late}" />

                                <h:outputText value="Handled by: " />
                                <h:outputText value="#{customerInvoiceEntityController.selected.payment.createdBy.fullname}" />
                            </h:panelGrid>  
                        </p:fieldset> 
                    </p:panel>
                </h:panelGroup>

            </h:form>
        </ui:define>
    </ui:composition>

</html>
